This repository was archived by the owner on Mar 19, 2025. It is now read-only.
Do not send user email when setting up TOTP as 2nd factor#104
Merged
damionvega merged 5 commits intomainfrom Feb 26, 2024
Merged
Do not send user email when setting up TOTP as 2nd factor#104damionvega merged 5 commits intomainfrom
damionvega merged 5 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Contributor
damionvega
commented
Feb 22, 2024
Comment on lines
+55
to
+80
| src: (context: AuthContext<any>, event: AuthMachineEvent) => { | ||
| const arg: Record<string, any> = { | ||
| method: "totp", | ||
| }; | ||
|
|
||
| if (hasValue((<TotpCodeSubmitEvent>event).totpCode)) { | ||
| arg.totpCode = (<TotpCodeSubmitEvent>event).totpCode; | ||
| } | ||
|
|
||
| // API only requires email/emailOrUsername when logging in via first factor | ||
| if (!context.isSecondFactor) { | ||
| if (hasValue(context.user.email)) { | ||
| arg.email = context.user.email; | ||
| } else if (hasValue(context.user.emailOrUsername)) { | ||
| arg.emailOrUsername = context.user.emailOrUsername; | ||
| } | ||
|
|
||
| arg.redirect = false; | ||
| } | ||
|
|
||
| return callUserfront({ | ||
| // Should ALWAYS be Userfront.login here | ||
| method: "login", | ||
| args: [ | ||
| { | ||
| method: "totp", | ||
| totpCode: (<TotpCodeSubmitEvent>event).totpCode, | ||
| email: context.user.email, | ||
| redirect: false, | ||
| }, | ||
| ], | ||
| }), | ||
| args: [arg], | ||
| }); | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
The email/emailOrUsername check has been added here.
Contributor
|
Published version 1.1.0-alpha.3 to npm. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normal
Closes DEV-1046
This will check for
emailoremailOrUsernameonly if TOTP is being set up as a first factor.I also removed the password instructions on the login form i.e.